package com.qf.mapper;

import com.qf.bean.Bargaininfo;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BargainMapper extends Mapper<Bargaininfo> {

    //分页条件模糊查询
    List<Bargaininfo> findAll(Map<String,Object> map);

    //根据id查询详情
    Bargaininfo findOne(Integer id);

    @Select("select count(1) from bargaininfo where bargainname=#{bargainname}")
    Integer findCountByName(String bargainname);

    @Select("select count(1) from bargaininfo where bargainname=#{bargainname} and id!=#{id}")
    Integer findCountById(Map<String, Object> map);

    //批量删除（假删除）
    Integer deleteInIds(List<Integer> bargainidList);

    //导出数据
    List<Bargaininfo> findBargainByIds(Integer[] bargainid);

    @Select("select id from bargaininfo where status=1 and remind=1 and endtime>now() and endtime <now() + interval 1 day")
    List<Integer> findDueIds();
}
